package olga.gorbatiuk.perdep.sorting.arrayfiller.impl;

final class ArrayElementsOrderingChecker {

    private ArrayElementsOrderingChecker() {
        throw new AssertionError();
    }

    static boolean isOrderOk(int[] array, Order order) {
        boolean isOrderOk = true;
        for (int i = 0; i < array.length - 1; i++) {
            isOrderOk = order.isOrderOk(array, i);
            if (!isOrderOk) {
                break;
            }
        }

        return isOrderOk;
    }
}
